package com.gs.djys.inquest.inquestlist;

import android.app.Activity;

import com.alibaba.fastjson.JSON;
import com.gs.djys.Base.MyAppliCation;
import com.gs.djys.Base.Urls;
import com.gs.djys.callback.StringDialogCallback;
import com.gs.djys.check.checklist.CheckListBean;
import com.gs.djys.mvp.BasePresenterImpl;
import com.lzy.okgo.OkGo;
import com.lzy.okgo.model.Response;

/**
 * MVPPlugin
 *  邮箱 784787081@qq.com
 */

public class InquestPresenter extends BasePresenterImpl<InquestContract.View> implements InquestContract.Presenter{
    @Override
    public void getData(String param, int page, Activity Activity) {
        OkGo.<String>get(Urls.SERVER + "/road/lictran/licApp/request/kyList")
                .params("param", param)
                .params("limit", "20")
                .params("page", page+"")
                .params("user_code", MyAppliCation.spUtils.getString("userCode"))
                .execute(new StringDialogCallback(Activity) {
                    @Override
                    public void onSuccess(Response<String> response) {
                        CheckListBean checkListBean = JSON.parseObject(response.body(),CheckListBean.class);
                        if (mView == null)
                            return;
                        if (checkListBean.getCode().equals("0000")){
                            mView.getDatas(checkListBean);
                        }else {
                            mView.onRequestError(checkListBean.getMessage());
                        }
                    }
                });
    }
}
